local qingxix = fk.CreateSkill {
  name = "qingxix",
}

qingxix:addEffect( "active", {
  anim_type = "offensive",
  card_num = 0,
  target_num = 1,
  prompt = "#qingxix",
  can_use = function(self, player)
    return not player:isKongcheng()
  end,
  card_filter = Util.FalseFunc,
  target_filter =function (self, player, to_select, selected, selected_cards, card, extra_data)
    return #selected == 0 and to_select:getHandcardNum() < player:getHandcardNum() and to_select:getMark("qingxix-phase") == 0 and
      not player:isProhibited(to_select, Fk:cloneCard("stab__slash"))
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:setPlayerMark(target, "qingxix-phase", 1)
    local n = player:getHandcardNum() - target:getHandcardNum()
    if n <= 0 then return end
    local cards = room:askForDiscard(player, n, n, false, self.name, false, ".|.|.|hand")
    if #cards < n then return end
    local use = {
      from = player,
      tos = {target},
      card = Fk:cloneCard("stab__slash"),
      extraUse = true,
    }
    use.card.skillName = self.name
    room:useCard(use)
  end,
})

return qingxix